﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Xyz.Web.Reservation.Models.BookingModel>" %>
<%@ Import Namespace="Xyz.Web.Reservation.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Booking
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Booking</h2>
    <% using (Html.BeginForm())
       {%>
    <fieldset>
        <legend>Booking Info</legend>
        <table style="width: 40%; border: 0; border-collapse: collapse">
            <tr>
                <td>
                    Trip Code :
                </td>
                <td>
                    <%: Model.TripCode %>
                </td>
                <td>
                    Status :
                </td>
                <td>
                    <%: Model.Status %>
                </td>
            </tr>
            <tr>
                <td>
                    Booking Date :
                </td>
                <td>
                    <%: String.Format("{0:g}", Model.BookingDate) %>
                </td>
            </tr>
        </table>
        <br />
        <br />
        <%if (Model.Status == "Reserved")
          {%>
        <div>
            <%: Html.ActionLink("Proceed to payment", "Index", "Payment") %>
        </div>
        <%if (Session["Customer"] != null && Session["Customer"].GetType() == typeof(AgentModel))
          {%>
        <div>
            <%: Html.ActionLink("Cancel Booking", "CancelBooking", "Booking") %>
        </div>
        <% } %>
        <% } %>
    </fieldset>
    <br />
    <% foreach (var ticketModel in Model.Tickets)
       {%>
    <fieldset>
        <legend>Ticket Info</legend>
        <% Html.RenderPartial("FlightInfo", ticketModel.Flight); %>
        <br />
        <table style="width: 100%; border: 0; border-collapse: collapse">
            <tr>
                <td style="width:257px;">
                    Passenger Name :
                </td>
                <td>
                    <%: string.Concat(ticketModel.Passenger.LastName, " ", ticketModel.Passenger.FirstName)%>
                </td>
            </tr>
            <tr>
                <td style="width:257px;">
                    Date of Birth :
                </td>
                <td style="width:235px;">
                    <%: ticketModel.Passenger.DateOfBirth%>
                </td>
                <td style="width:215px;">
                    Passport Number :
                </td>
                <td>
                    <%: ticketModel.Passenger.PassportNo%>
                </td>
            </tr>
            <tr>
                <td>
                    Passport Expiry Date :
                </td>
                <td>
                    <%: ticketModel.Passenger.PassportExpiryDate%>
                </td>
                <td>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                    Email Address :
                </td>
                <td>
                    <%: ticketModel.Passenger.EmailAddress%>
                </td>
                <td>
                    Contact No :
                </td>
                <td>
                    <%: ticketModel.Passenger.ContactNo%>
                </td>
            </tr>
        </table>
    </fieldset>
    <% } %>
    <br />
    <br />
    <% } %>
</asp:Content>
